<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    //Request上使用body.text()
    // let request = new Request('https://foo.com', {
    //     method: 'POST',
    //     body: 'HELLO WORLD'
    // })
    // request.text().then(res => { console.log(res); })
    //Response上使用body.text();
    // fetch('https://www.baidu.com', {
    //     method: "POST",
    //     body: "HELLO SMITH"
    // }).then(response =>
    //     response.text()
    // ).then(res => {
    //     console.log(res);
    // })
    fetch('https://fetch.spec.whatwg.org/')
        .then((response) => response.body)
        .then((body) => {
            let reader = body.getReader();
            console.log(reader); // ReadableStreamDefaultReader {} 
            reader.read()
                .then(console.log);
        });
</script>

</html>